/*
 * @Descripttion: your project
 * @version: 1.0
 * @Author: hongweixun
 * @Date: 2022-07-07 08:24:12
 * @LastEditors: liyin 2179253556@qq.com
 * @LastEditTime: 2024-02-29 17:15:15
 */
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './plugins/index.js'
import './assets/css/global.css'
import './assets/css/bass.less'
import './plugins/element.js'
import Util from './util/util.js'
// 导入封装的websocket组件
import * as socketApi from './websocket/socket'
import axios from 'axios'
import '@/assets/icon'
// 引入rem.js
import './util/rem.js'
import Footer from './components/Common/Footer.vue'
import * as echarts from 'echarts'
import animated  from 'animate.css'
axios.defaults.baseURL = 'http://host.hlzhjy.com:33790'
// 配置拦截器，携带token令牌
// 在request拦截器中，展示进度条Nprogress.start()
axios.interceptors.request.use(config => {
  if (window.sessionStorage.getItem('token')) {
    config.headers.accessToken = window.sessionStorage.getItem('token')
  } else {
    config.headers.accessToken = 1
  }
  return config
})
// 配置response响应拦截器
// 在response拦截其中，结束进度条Nprogress.done()
axios.interceptors.response.use(config => {
  // window.sessionStorage.setItem('statusCode', config.status)
  return config
})
Vue.prototype.$http = axios
Vue.prototype.$echarts = echarts
// 全局注册使用util类
Vue.prototype.$util = Util
Vue.use(animated)
// 全局注册使用websocket
Vue.prototype.$socket = socketApi
Vue.config.productionTip = false
Vue.component('Footer', Footer)
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
